package utils;

import element.MyObject;
import element.Shit;

import java.awt.*;

/**
 * @author 邓哈哈
 * 2023/2/23 20:16
 * Function:
 * Version 1.0
 */

public class Constant {
    //最短线长
    public static final int MIN_LENGTH = 100;
    //最长线长
    public static final int MAX_LENGTH = 800;
    //红线速度(快)
    public static int MAX_SPEED = 5;
    //红线速度(慢)
    public static int MIN_SPEED = 2;
    //总分
    public static int COUNT = 0;
    //药水是否使用(默认不适用)
    public static boolean WATER_FLAG = false;
    //药水数量
    public static int WATER_COUNT = 5;
    //目标得分
    public static int GOAL_COUNT = (int) (Math.random() * (175 - 135) + 135);
    //当前关卡
    public static int LEVEL = 1;
    //起始时间
    public static long START_TIME = System.currentTimeMillis();
    //结束时间
    public static long END_TIME = System.currentTimeMillis();
    //实际显示时间
    public static long TIM = 1;

    /**
     * 绘制得分
     *
     * @param g
     * @param count
     */
    public static void drawCount(MyObject myObject, Graphics g, int count) {
        if (myObject instanceof Shit) {
            drawWords(g, "" + count, 30, Color.RED, 430, 250);
            return;
        }

        drawWords(g, "+" + count, 30, Color.GREEN, 430, 250);
    }

    /**
     * 绘制药水状态
     *
     * @param g
     */
    public static void drawHint(Graphics g) {
        drawWords(g, "药水正在使用中", 30, Color.BLUE, 460, 160);
    }

    /**
     * 绘制文字模板
     *
     * @param g     画笔
     * @param words 文字
     * @param size  大小
     * @param color 颜色
     * @param x     横坐标
     * @param y     纵坐标
     */
    public static void drawWords(Graphics g, String words, int size, Color color, int x, int y) {
        g.setColor(color);
        g.setFont(new Font("仿宋", Font.BOLD, size));
        g.drawString(words, x, y);
    }

}
